<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="../org/angular.min.js"></script>
    <script src="../org/jquery.min.js"></script>
</head>
<body>

<div ng-app="hd">
    <div ng-controller="ctrl1">
        {{name}} <input type="text" ng-model="name">
        <hr>
        <hd-cms></hd-cms>
    </div>

</div>


<script>
    var m = angular.module('hd', []);
    m.directive('hdCms', function () {
        //构建指令的代码
        return {
            restrict:'EA',   //指生成指令在页面中的表现形式: A 是指attr  E 是指element C 是指class，不建议使用C
            template: '{{name}}<input type="text" ng-model="name">',
            scope: true,
        }
    });

    m.controller('ctrl1', ['$scope', function ($scope) {
        $scope.name = '后盾人';
    }]);

</script>


</body>
</html>

